package com.xiyu.service.controller.admin.setting;
import com.xiyu.service.vo.setting.globalSetting.GlobalSettingUpdateInput;
import com.xiyu.service.vo.setting.globalSetting.GlobalSettingQueryByClassOutput;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;

import jakarta.validation.*;

import java.util.*;

import com.xiyu.service.framework.web.web.core.pojo.PageResult;
import com.xiyu.service.framework.web.web.core.pojo.CommonResult;
import static com.xiyu.service.framework.web.web.core.pojo.CommonResult.success;

import com.xiyu.service.framework.excel.core.util.ExcelUtils;

import com.xiyu.service.framework.operateLog.core.annotations.OperateLog;
import static com.xiyu.service.framework.operateLog.core.enums.OperateTypeEnum.*;

import com.xiyu.service.service.setting.GlobalSettingService;

@Tag(name = "全局设置")
@RestController
@RequestMapping("/setting/global-setting")
@Validated
public class GlobalSettingController {

    @Resource
    private GlobalSettingService globalSettingService;

    @PostMapping("/query-by-class")
    @Operation(summary = "根据分类查询全局配置")
    @Parameter(name = "settingClass", description = "分类", example = "")
    public CommonResult<List<GlobalSettingQueryByClassOutput>> queryByClass(@RequestParam("settingClass") String settingClass) {
        return success(globalSettingService.queryByClass(settingClass));
    }

    @PostMapping("/update")
    @Operation(summary = "更新全局配置")
    public CommonResult<Boolean> update(@Valid @RequestBody List<GlobalSettingUpdateInput> inputVO) {
        return success(globalSettingService.update(inputVO));
    }

}
